<?php
/**
 * 用户评论
 */
namespace app\api\model;

use think\Db;
use think\Model;

class Comment extends Model{
    //获取评论列表
    public function commentList($gid){
        if ($gid <0 || empty($gid)){
            return false;
        }
        $where['goods_id'] = $gid;
        $where['is_show'] = 1;
        $where['goods_id'] = $gid;

        $data = Db::name('comment')
                        ->field('comment_id,content,img,goods_rank,add_time,username')
                        ->where($where)
                        ->select();
        if ($data){
            return $data;
        }else{
            return false;
        }
    }
}